$(document).ready(function(){

  $('#registerId').validate({

    rules:{
      'uname':{
        'required':true,
        'minlength':6,
        'maxlength':20
      },
      'email':{
        'required':true,
        'email':true,
        'remote':'ajax_email.php',
      },
      'password':{
        'required':true,
        'minlength':8
      },
      'c_password':{
        'required':true,
        'equalTo':'#passwordId'
      },
      'gender':{
        'required':true
      },
      'dob':{
        'required':true,
        'dateISO':true
      },

      'avatar':{
        'required':true,
        'accept':'gif|jpeg|png|jpg'
      },
      'e_avatar':{
        'accept':'gif|jpeg|png|jpg'
      }
    },

  messages: {
    'uname':{
      required: "User name should not be blank.",
      minlength: $.format("Username should be {0} char long."),

    },
    'email':{
      'required':'Email should not be blank',
      'email':'Please enter valid email Id',
      'remote':''
    },
    //'password':{
      //'required':'Password should not be blank',
      //'minlength':$.format("Passowrd should be {0} char long.")
    //},
    //'c_password':{
      //'required':'Re-Password should not be blank',
      //'equalTo':'Password not matched'
    //},
      'dob':{
      'required':'Date of Birth is required',
      'dateISO':'Date should be in YYYY-MM-DD'
    },
    'gender':{
      'required':'Please select any gender'
    },

    'address':{
      'required':'Address should not be blank',
      'minlength':$.format("Address should be {0} char long.")
    },
    'country':{
      'required':'Please select any country'
    },

    'lang[]':{
      'required':'Please select lang',
      'minlength':$.format("Please select atleast {0} lang.")
    },

    'hobbies[]':{
      'required':'Please select hobbies',
      'minlength':$.format("Please select atleast {0} hobbies.")
    },
    'upload':{
      'required':'Please Upload Avatar',
      'accept':$.format("Please upload file with valid ({0}) extn..")
    }
  }

  });

});
